package com.ws.base.common.datadict.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ws.base.common.datadict.entity.Datadictdetail;
import com.ws.base.db.support.DBSqlIdSupport;

public class DatadictDao {
    private DBSqlIdSupport dbSqlIdSupport;

    public DBSqlIdSupport getDbSqlIdSupport() {
        return dbSqlIdSupport;
    }

    public void setDbSqlIdSupport(DBSqlIdSupport dbSqlIdSupport) {
        this.dbSqlIdSupport = dbSqlIdSupport;
    }

    public List<Datadictdetail> getDatadictById(String datadictId) {
        Map<String, Object> condition = new HashMap<String, Object>();
        condition.put("datadictid", datadictId);

        List<Map<String, Object>> list = dbSqlIdSupport.query(
                "ws_datadict_queryDatadictById", condition, null, null);
        List<Datadictdetail> datadictdetails = new ArrayList<Datadictdetail>();
        Datadictdetail datadictdetail = null;

        for (Map<String, Object> map : list) {
            datadictdetail = new Datadictdetail();
            datadictdetail.setDatadictId((String) map.get("datadictid"));
            datadictdetail.setTypeId((String) map.get("typeid"));
            datadictdetail.setDescription((String) map.get("description"));
            datadictdetails.add(datadictdetail);
        }
        return datadictdetails;
    }

}
